<template>
	<view class="all">
		<view class="box" v-for="(item,index) in news_list" :key="index" @click="news_detail_api(item.news_id)">
			<image style="width: 150upx;height: 100upx;" :src="item.image"></image>
			<view style="width: 500upx;font-size: 26upx;color: #333;margin-left: 10upx;line-height: 100upx;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">{{item.title}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				news_list:[]
			}
		},
		onShow() {
			this.news_list_api()
		},
		methods: {
			news_detail_api(news_id) {
				uni.navigateTo({
					url:'../news_detail/news_detail?news_id='+news_id
				})
			},
			news_list_api() {
				var that = this
				that.$request(that.$Api.news_list_api, {
					access_token: uni.getStorageSync('access_token'),
				}, "POST").then(res => {
					if (res.data.code == 0) {
						that.news_list = res.data.data.list
					} else {
						uni.showToast({
							title: res.data.msg,
							duration: 2000,
							icon: 'none'
						});
					}
				})
			},
		}
	}
</script>

<style lang="less">
	page{
		.all{
			.box{
				width: 680upx;
				display: flex;
				// justify-content: ;
				background: #fff;
				border-radius: 10upx;
				padding: 10upx;
			}
			width: 700upx;
		}
		width: 700upx;
		padding: 25upx;
		background: #eee;
	}
</style>
